package wonders.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;
import java.util.List;
import java.util.Map;

@RestController
public class HelloController {

    @Autowired
    private DataSource dataSource;

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @RequestMapping("hello")
    public String hello() {
        System.out.println(dataSource);
        return "hello";
    }

    @RequestMapping("jdbct")
    public String jdbct() {
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from app_files");
        System.out.println(maps);
        return "hello";
    }
}
